package com.gx.auth.common;

import lombok.Data;

import java.io.Serializable;

/**
 * Created by gx on 2017/4/3.
 */
@Data
public class AjaxResult implements Serializable {
    public static final Integer AJAX_STATUS_CODE_SUCCESS = 0;
    public static final Integer AJAX_STATUS_CODE_WARN = 1;
    public static final Integer AJAX_STATUS_CODE_ERROR = 2;
    private static final long serialVersionUID = -257832272624639618L;


    private String message;
    private Integer statusCode;

    public AjaxResult() {
        super();
    }

    public static AjaxResult success() {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setStatusCode(AjaxResult.AJAX_STATUS_CODE_SUCCESS);
        ajaxResult.setMessage("操作成功");
        return ajaxResult;
    }

    public static AjaxResult error() {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setStatusCode(AjaxResult.AJAX_STATUS_CODE_ERROR);
        ajaxResult.setMessage("操作错误");
        return ajaxResult;
    }

    public static AjaxResult warn() {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setStatusCode(AjaxResult.AJAX_STATUS_CODE_WARN);
        ajaxResult.setMessage("操作警告");
        return ajaxResult;
    }
}
